<?php

namespace app\models\jasper;

trait JasperApiEventplanTrait
{
    /**
     * @param string $iccid
     * @return \stdClass
     * @throws \Exception
     */
    public function GetAvailableEvents($iccid)
    {
        return $this->call(
            preg_replace('/.*JasperApi(.*?)Trait/', '$1', __TRAIT__),
            __FUNCTION__,
            [
                'iccid' => $iccid,
            ]
        );
    }

    /**
     * @param string $iccid
     * @param string $eventName
     * @param integer $effectiveDate
     * @param boolean $effectiveDateSpecified
     * @return \stdClass
     * @throws \Exception
     */
    public function ActivateTerminalEvent($iccid, $eventName, $effectiveDate, $effectiveDateSpecified)
    {
        return $this->call(
            preg_replace('/.*JasperApi(.*?)Trait/', '$1', __TRAIT__),
            __FUNCTION__,
            [
                'iccid' => $iccid,
                'eventName' => $eventName,
                'effectiveDate' => date('c', $effectiveDate),
                'effectiveDateSpecified' => $effectiveDateSpecified,
            ]
        );
    }

    /**
     * @param string $iccid
     * @param integer $since
     * @param boolean $sinceSpecified
     * @return \stdClass
     * @throws \Exception
     */
    public function GetTerminalEvents($iccid, $since, $sinceSpecified)
    {
        return $this->call(
            preg_replace('/.*JasperApi(.*?)Trait/', '$1', __TRAIT__),
            __FUNCTION__,
            [
                'iccid' => $iccid,
                'since' => date('c', $since),
                'sinceSpecified' => $sinceSpecified,
            ]
        );
    }

    /**
     * @param integer $eventInstanceId
     * @return \stdClass
     * @throws \Exception
     */
    public function DeleteTerminalEvent($eventInstanceId)
    {
        return $this->call(
            preg_replace('/.*JasperApi(.*?)Trait/', '$1', __TRAIT__),
            __FUNCTION__,
            [
                'eventInstanceId' => $eventInstanceId,
            ]
        );
    }
}
